\section{Example implementation}
\label{app-example-implementation}

As an example of how the sequence functions might be implemented using
the functions and macros in \refApp{app-protocol}, we show our
implementation of \texttt{find-list} which is called from
\texttt{find} when the sequence is known to be a list:

{\small\begin{verbatim}
(defun find-list
    (item list from-end test test-not start end key)
  (declare (optimize (speed 3) (debug 0) (safety 0)))
  (declare (type list list))
  (with-bounding-indices-list (start end)
    (with-key-function key
      (with-test-and-test-not (test test-not)
        (with-from-end from-end
          (for-each-relevant-cons
              (cons index list start end from-end)
            (let ((element (apply-key-function 
                            (car cons) key)))
              (when (satisfies-two-argument-test-p 
                     item element test test-not)
                (return-from find-list element)))))))))
\end{verbatim}}

